package com.hk.developmentlib.view.itemdecoration;

import android.content.Context;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.hk.developmentlib.utills.DeviceUtils;


/**
 * https://github.com/CymChad/BaseRecyclerViewAdapterHelper
 */
public class BaseItemTopDecoration extends RecyclerView.ItemDecoration {
    private int space;

    public BaseItemTopDecoration(Context ct, int space) {
        ;
        this.space = DeviceUtils.dip2px(ct, space);
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {

//        if (parent.getChildPosition(view) != 0){
//            outRect.top = space;
//        }else{
//            outRect.top = 0;
//        }
        outRect.top = space;
    }
}
